<?php
class Entry
{
	public static function IsLogin()
	{
		return isset($_SESSION['login'])&&$_SESSION['login'];
	}
	public static function IsActionLogin()
	{
		return isset($GLOBALS['action'])&&$GLOBALS['action']=='login';
	}
	public static function IsActionLogout()
	{
		return isset($GLOBALS['action'])&&$GLOBALS['action']=='logout';
	}
	public static function Login($continue=true)
	{
		global $user,$password;
		if($user!=''&&$password!=''&&$user==$GLOBALS['CONFIG']['user']&&$password==$GLOBALS['CONFIG']['password'])
		{
			$_SESSION['login']=true;
		}
		else
		{
			$_SESSION['login']=false;
		}
		if(!$continue)
		{
			self::Redirect();
		}
		return $_SESSION['login'];
	}
	public static function Logout($continue=true)
	{
		$_SESSION['login']=false;
		if(!$continue)
		{
			self::Redirect();
		}
	}
	public static function Redirect($url='index.php')
	{
		header('location:'.$url);
		exit();
	}
	
}
?>